package com.cskaoyan.service;

import com.cskaoyan.bean.bo.FeedbackSubmitBo;
import com.cskaoyan.bean.entity.Feedback;
import com.cskaoyan.mapper.FeedbackMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class FeedbackServiceImpl implements FeedbackService{

    @Autowired
    FeedbackMapper feedbackMapper;

    // 将反馈添加到数据库
    @Override
    public Integer insertFeedback(FeedbackSubmitBo feedbackBo) {

        // 将图片url有数组转为字符串
        String picUrls = feedbackBo.getPicUrls().toString();

        Feedback feedback = new Feedback(feedbackBo.getMobile(),feedbackBo.getFeedType(),feedbackBo.getContent(),feedbackBo.getHasPicture(),picUrls);
        int affected = feedbackMapper.insertSelective(feedback);

        return affected;

    }

}
